home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9101 / olympia1.jan < prev    next >
Text File  |  1990-11-02  |  2KB  |  80 lines

  1.  
  2. LISTING 1 for Olympia/jan 91
  3.  
  4. PROCEDURE L_TBAR
  5. */ Displays the percent of processing completed, N_Current/N_Total.
  6. *************************************************************
  7. * PROCEDURE ....... : L_TBAR
  8. * VERSION ......... : $Revision$
  9. * LAST EDITED ON .. : $Date$
  10. * LANGUAGE ........ : FoxPro
  11. * CALLS TO ........ : L_Quote (see DBMS, 8/90 issue)
  12. * PURPOSE ......... : Displays the percent of processing which has been
  13. *                   : completed based upon the number of items or steps
  14. *                   : which has been processed (N_Current) as a %
  15. *                   : of the total number to be processed (N_Total).
  16. *                   : The calling program is responsible for incrementing
  17. *                   : the N_Current parameter each time through the
  18. *                   * processing loop or at appropriate intervals.
  19. * CALLING SEQUENCE  : DO L_TBAR WITH <N_Current>, <N_Total>, <C_Message>
  20. * LOCAL VARIABLES . : PCent, W_Tbar, Puffin
  21. * GLOBAL VARIABLES  : Begintime
  22. * PARAMETERS ...... : N_Current, N_Total, C_Message
  23. ***************************************************************************
  24.  
  25. PARAMETERS N_Current, N_Total, C_Message
  26.  
  27. PRIVATE PCent, Puffin
  28.  
  29. * Initialize the local variables.
  30. PCent = N_Current * 10 / N_Total
  31.  
  32. * Is this the first call?
  33. IF .NOT. WEXIST('W_Tbar')
  34.    * Create the window display.
  35.    DEFINE WINDOW W_Tbar FROM 16,17 TO 22,62 DOUBLE COLOR +W/B
  36.    ACTIVATE WINDOW W_Tbar
  37.    @ 0,2 SAY PADC(C_Message,40) COLOR +W/B
  38.    @ 1,6 TO 3,37 COLOR +W/B
  39.    @ 4,6 SAY '0  1  2  3  4  5  6  7  8  9  10' COLOR W/B
  40.  
  41.    * Turn off the cursor.
  42.    x = SYS(2002)
  43.  
  44.    * Display the first quotation.
  45.    Begintime = VAL(SYS(2)) - Interval - 1
  46.    DO L_QUOTE
  47. ENDIF
  48.  
  49. * Update thermometer display?
  50. IF PCent > 0
  51.    * Display percent complete.
  52.    IF .NOT. WONTOP('W_Tbar')
  53.       ACTIVATE WINDOW W_Tbar
  54.    ENDIF
  55.    @ 2,7 SAY REPLICATE(CHR(219), ROUND(PCent*3,0)) COLOR W/B
  56.  
  57.    * Is it time for a new quote from the Cookie database?
  58.    DO L_QUOTE
  59.  
  60.    * Check for completion of processing.
  61.    IF N_Current >= N_Total
  62.       Puffin = INKEY(1)
  63.       DEACTIVATE WINDOW W_Tbar
  64.       RELEASE WINDOW W_Tbar
  65.    
  66.       * Turn on the cursor.
  67.       x = SYS(2002,1)
  68.  
  69.       * Clear the quote from the screen.
  70.       PrevWindow = IIF('' = WONTOP(), 'SCREEN', 'WINDOW '+WONTOP())
  71.       ACTIVATE SCREEN
  72.       @ 24,1 CLEAR TO 24,79
  73.       ACTIVATE &PrevWindow
  74.  
  75.    ENDIF
  76.  
  77. ENDIF
  78.  
  79. RETURN
  80.